package com.wlz.tboxApi;


import javax.annotation.Resource;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * @author wlz
 * @date 2023-03-29  17:17
 */
public class Test {

//    @ApiOperation("F6接口")
//    @PostMapping({"f6"})
//    @ResponseBody
//    public F1Response f6(@RequestBody F0Request request, HttpServletRequest server) {
////        log.info("接收到F6接口请求,请求参数：{}", request);
//        MyThreadPool.execute(() -> {
//            //APP推送
//            try {
//                appMsgPush(request.getVIN(),request.getUDate());
//            } catch (Exception e) {
//                log.error("F6接口推送app失败，VIN： " + request.getVIN() + " ,异常信息：{}", e);
//            }
//        });
//        F1Response f1Response = new F1Response();
//        f1Response.setCode(1);
//        return f1Response;
//    }

//    @Resource
//    private RestTemplate restTemplate;
//
//    public void appMsgPush(String vinNo,String time) throws IOException {
//        log.info("开始请求APP升级信息推送接口, VIN:{}, 请求参数为:{}", vinNo);
//        HttpHeaders headers = new HttpHeaders();
//        HashMap<String,Object> params = new HashMap<>();
//        params.put("VIN", vinNo);
//        headers.set("Content-Type", "application/json");
//        String url = null;
//        if (ObjectUtils.isEmpty(time)) {
//            url = "http://127.0.0.1:9953/approval/test";
//        }else {
//            url = "http://127.0.0.1:9953/approval/test?time=" + time;
//        }
////        HttpEntity<JSONObject> jsonObject = restTemplate.exchange(url,
////                        HttpMethod.GET, new HttpEntity<>(JSONObject.toJSONString
////                                (params), headers), JSONObject.class);
//
//        Map<String, Object> headParamsMap = new HashMap<>();
//        headParamsMap.put("Authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlSW5mbyI6IntcInJvbGVJZFwiOlwiMTU4NDZjNzEtZDRhOS00ZTA1LWE1MDktZmNlYzVhY2U3MWIxXCIsXCJyb2xlTmFtZVwiOlwi5bel5Y6CXCIsXCJyb2xlVHlwZVwiOjQsXCJyb2xlU3ViVHlwZVwiOjEsXCJ3ZWlnaHRcIjo0MDAsXCJpc1N5c1wiOjAsXCJkYXRhU2NvcGVcIjowLFwiaXNMYXJnZVZlcnNpb25cIjowfSIsImNhclR5cGVJbmZvIjoie1wiY2FyVHlwZUlkXCI6XCJjNDFkNTI0Yi04YjM0LTRiZTUtODhjMy1mZjNmZjViZDE4YzlcIixcImNhclR5cGVOYW1lXCI6XCJBUkNGT1gtzrFTXCIsXCJzZXJ2aWNlTmFtZVwiOm51bGwsXCJzZXJ2aWNlVXJsXCI6bnVsbH0iLCJ1c2VyVHlwZSI6IlBMQVRGT1JNIiwiaWQiOiI2MTYzZTU4ZC0yNTQ2LTRhZGUtYjIzNy01YzlkMDE1YTQ0MWYiLCJleHAiOjE2ODAwODc2NTksImlhdCI6MTY4MDA4MDQ1OX0.dmi_RU1ccGA-DM-YcISnubS4jrXLGueMreLmx8zCE68");
//        OkHttpUtils.get("https://lbfota.bjev.com.cn/api/three/approval",headParamsMap);
////        log.info("接受到app的回复消息为：" + new Gson().toJson(jsonObject));
////        log.info("发送给APP推送接口的数据为：" + new Gson().toJson(params));
////        if ("0".equals(Objects.requireNonNull(jsonObject.getBody()).getString("code"))) {
////            log.info("消息推送成功,vin为:{} ", vinNo);
////        }
//    }


//    @GetMapping("/test")
//    public BasePageResponse test(@RequestParam(value = "time", required = false)Integer time) {
////        log.info("time : {}", time);
//        if (!ObjectUtils.isEmpty(time)) {
//            try {
//                Thread.sleep(time);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        }
////        return new BasePageResponse(1, "成功");
//        return approvalService.message();
//    }
}
